<template>
  <exception-page
    home-route="/dashboard"
    :style="`min-height: ${minHeight}`"
    type="404"
  />
</template>

<script>
import { checkAuthorization } from "@/utils/request";
import ExceptionPage from "@/components/exception/ExceptionPage";
import { mapState } from "vuex";
export default {
  name: "Exp404",
  components: { ExceptionPage },
  computed: {
    ...mapState("setting", ["pageMinHeight"]),
    minHeight() {
      return this.pageMinHeight ? this.pageMinHeight + "px" : "100vh";
    }
  },
  // eslint-disable-next-line no-unused-vars
  beforeRouteEnter(to, from, next, options) {
    if (!checkAuthorization()) {
      next((vm) => {
        vm.$message.warning("登录已失效，请重新登录");
        vm.setTimeout = setTimeout(() => {
          vm.$router.replace("/login");
        }, 1000);
      });
    } else {
      next();
    }
  },
  beforeDestroy() {
    clearTimeout(this.setTimeout);
  }
};
</script>

<style scoped lang="less"></style>
